from datetime import datetime

import dotenv

from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

dotenv.load_dotenv()

# 1.编排prompt
prompt = ChatPromptTemplate.from_messages([
    ("system", "你是个AI机器人，根据用户的提问回答"),
    ("human", "{query}")
]).partial(now=datetime.now())

# 2. 创建大语言模型
llm = ChatOpenAI(model_name="kimi-k2-0711-preview")

ai_message = llm.batch([
    prompt.invoke({"query": "你好，你是？"}),
    prompt.invoke({"query": "请你好好介绍下jojo"})
])

for ai_message_on in ai_message:
    print(ai_message_on.content)
